home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-2-2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  5.2 KB  |  183 lines

  1. VERSION 5.00
  2. Begin VB.Form frm13_2_2 
  3.    Caption         =   "Semester Grades"
  4.    ClientHeight    =   5940
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4770
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5940
  10.    ScaleWidth      =   4770
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton cmdSemGrade 
  13.       Caption         =   "Calculate Grades"
  14.       Height          =   495
  15.       Left            =   1800
  16.       TabIndex        =   15
  17.       Top             =   2160
  18.       Width           =   1332
  19.    End
  20.    Begin VB.PictureBox picGrades 
  21.       Height          =   1935
  22.       Left            =   120
  23.       ScaleHeight     =   1875
  24.       ScaleWidth      =   4395
  25.       TabIndex        =   14
  26.       Top             =   3960
  27.       Width           =   4452
  28.    End
  29.    Begin VB.Frame fraType 
  30.       Caption         =   "Type of Registration"
  31.       Height          =   735
  32.       Left            =   600
  33.       TabIndex        =   11
  34.       Top             =   1200
  35.       Width           =   3495
  36.       Begin VB.OptionButton optPF 
  37.          Caption         =   "Pass/Fail"
  38.          Height          =   255
  39.          Left            =   1680
  40.          TabIndex        =   13
  41.          Top             =   360
  42.          Width           =   1215
  43.       End
  44.       Begin VB.OptionButton optReg 
  45.          Caption         =   "Regular"
  46.          Height          =   255
  47.          Left            =   360
  48.          TabIndex        =   12
  49.          Top             =   360
  50.          Width           =   1095
  51.       End
  52.    End
  53.    Begin VB.CommandButton cmdQuit 
  54.       Caption         =   "&Quit"
  55.       Height          =   495
  56.       Left            =   3480
  57.       TabIndex        =   10
  58.       Top             =   2160
  59.       Width           =   1092
  60.    End
  61.    Begin VB.CommandButton cmdDisplay 
  62.       Caption         =   "&Display Single Grade"
  63.       Height          =   495
  64.       Left            =   120
  65.       TabIndex        =   9
  66.       Top             =   2880
  67.       Width           =   2655
  68.    End
  69.    Begin VB.TextBox txtFinal 
  70.       Height          =   285
  71.       Left            =   3600
  72.       TabIndex        =   6
  73.       Top             =   720
  74.       Width           =   375
  75.    End
  76.    Begin VB.TextBox txtMidterm 
  77.       Height          =   285
  78.       Left            =   2520
  79.       TabIndex        =   5
  80.       Top             =   720
  81.       Width           =   375
  82.    End
  83.    Begin VB.TextBox txtSSN 
  84.       Height          =   285
  85.       Left            =   600
  86.       TabIndex        =   3
  87.       Top             =   720
  88.       Width           =   1095
  89.    End
  90.    Begin VB.TextBox txtName 
  91.       Height          =   285
  92.       Left            =   720
  93.       TabIndex        =   1
  94.       Top             =   120
  95.       Width           =   3495
  96.    End
  97.    Begin VB.CommandButton cmdAdd 
  98.       Caption         =   "&Add Student"
  99.       Height          =   495
  100.       Left            =   240
  101.       TabIndex        =   0
  102.       Top             =   2160
  103.       Width           =   1212
  104.    End
  105.    Begin VB.Label lblFinal 
  106.       Caption         =   "Final"
  107.       Height          =   255
  108.       Left            =   3120
  109.       TabIndex        =   8
  110.       Top             =   720
  111.       Width           =   375
  112.    End
  113.    Begin VB.Label lblMidterm 
  114.       Caption         =   "Midterm"
  115.       Height          =   255
  116.       Left            =   1800
  117.       TabIndex        =   7
  118.       Top             =   720
  119.       Width           =   615
  120.    End
  121.    Begin VB.Label lblSSN 
  122.       Caption         =   "SSN"
  123.       Height          =   255
  124.       Left            =   120
  125.       TabIndex        =   4
  126.       Top             =   720
  127.       Width           =   375
  128.    End
  129.    Begin VB.Label lblName 
  130.       Caption         =   "Name"
  131.       Height          =   255
  132.       Left            =   120
  133.       TabIndex        =   2
  134.       Top             =   120
  135.       Width           =   495
  136.    End
  137. Attribute VB_Name = "frm13_2_2"
  138. Attribute VB_GlobalNameSpace = False
  139. Attribute VB_Creatable = False
  140. Attribute VB_PredeclaredId = True
  141. Attribute VB_Exposed = False
  142. Private pupil As Object
  143. Dim section As New Collection
  144. Private Sub Form_Load()
  145.   optReg = True
  146. End Sub
  147. Private Sub cmdAdd_Click()
  148.   If optReg.Value Then
  149.       Set pupil = New CSTudent
  150.     Else
  151.       Set pupil = New CPFStudent
  152.   End If
  153.   'Read the Values stored in the Text boxes
  154.   pupil.Name = txtName
  155.   pupil.SocSecNum = txtSSN
  156.   pupil.midGrade = Val(txtMidterm)
  157.   pupil.finGrade = Val(txtFinal)
  158.   section.Add pupil, txtSSN.Text
  159.   'Clear Text Boxes
  160.   txtName.Text = ""
  161.   txtSSN.Text = ""
  162.   txtMidterm.Text = ""
  163.   txtFinal.Text = ""
  164. End Sub
  165. Private Sub cmdSemGrade_Click()
  166.   Dim i As Integer, grade As String
  167.   picGrades.Cls
  168.   For i = 1 To section.Count
  169.     picGrades.Print section.Item(i).Name; Tab(28); section.Item(i).SocSecNum; _
  170.                     Tab(48); section.Item(i).SemGrade
  171.   Next i
  172. End Sub
  173. Private Sub cmdDisplay_Click()
  174.   Dim ssn As String
  175.   ssn = InputBox("Enter the student's social security number.")
  176.   picGrades.Cls
  177.   picGrades.Print section.Item(ssn).Name; Tab(28); section.Item(ssn).SocSecNum(); _
  178.                   Tab(48); section.Item(ssn).SemGrade
  179. End Sub
  180. Private Sub cmdQuit_Click()
  181.   End
  182. End Sub
  183.